<?php

namespace Jinxing\Admin\Models;

use Illuminate\Database\Eloquent\Model;

class RoleMenus extends Model
{
    protected $table      = 'role_menus';
    public    $timestamps = false;
    public    $columns    = [
        'id',
        'role_id',
        'menu_id',
    ];

    /**
     * @var array 批量赋值的黑名单
     */
    protected $guarded = ['id'];

    public function scopeParent($query, $value)
    {
        return $query->join('menus', 'menus.id', '=', 'role_menus.menu_id')->where('menus.parent', '!=', $value);
    }
}